package com.sunwhite.codeidea.innerclass;

/**
 * 内部类测试.this
 */
public class DoThis {
    void f(){
    System.out.println("DoThis.f()"+this);
    }

    public class Inner{
        public DoThis outer(){
            return DoThis.this;
        }
    }

    public Inner inner(){
        return new Inner();
    }

  public static void main(String[] args) {
    //
      DoThis doThis = new DoThis();
      DoThis.Inner inner=doThis.inner();
      DoThis outer = doThis.inner().outer();
    System.out.println(outer);
      inner.outer().f();
      doThis.f();
      //内部类的创建方式，必须要先创建外部对象
      Inner inner1 = doThis.new Inner().outer().inner();
      inner.outer().f();
  }
}
